package com.lkbaby.composite;

import java.util.ArrayList;
import java.util.List;

public class School extends Department {

	private List<Department> list = new ArrayList<>();

	public School(String name) {
		super(name);
	}

	@Override
	public void show() {
		System.out.println("--- " + name + " ---");
		list.forEach(o -> o.show());
	}

	@Override
	public void add(Department department) {
		System.out.println(name + ": add " + department.name);
		list.add(department);
	}

}
